/**************************************************************************************** Import */
import _ from 'lodash';
import React, {Component} from 'react';
import { TextInput, View, Dimensions, TouchableHighlight, StyleSheet } from 'react-native';
import { Icon,  List, Button, InputItem, Tabs, TextareaItem, DatePicker, Accordion, Picker } from 'antd-mobile-rn';
import { CAround, CBetween, CCenter, CColumn, CFloat, CHand, CItemX, CItemY, CLine, CLoad, CRow, CWrap, CBone, CIcon, CImage, CSvg, CText, CFull, CScroll, CFooter, CHeader, CPage, CButton, CLabel, PTabbar, PHeader } from '../../../../library/comp';
import { Dialog, Http, PageBase } from '../../../../library/func';
import Design from '../../../../design';
import Config from '../../../../config';

/**************************************************************************************** Pageload */

/**************************************************************************************** Cacheload */

/**************************************************************************************** Preload */

/**************************************************************************************** Get */

/**************************************************************************************** Post */

/**************************************************************************************** Page */
export default class MyHouse extends PageBase {
	constructor(props) {
        super(props);
		this.state = {
			apply:[
                {
                    id:1,
                    subdistrict_name:"珑城花园",
                    unit_name:"一号楼一单元",
                    enum_apply_status:"户主",
                    enum_checked:"审核中",

                },
                {
                    id:2,
                    subdistrict_name:"珑城花园",
                    unit_name:"一号楼二单元",
                    enum_apply_status:"户主",
                    enum_checked:"审核中",

                },
            ],
			house:[
                {
                    id:3,
                    subdistrict_name:"珑城花园",
                    unit_name:"二号楼一单元",
                    enum_status:"户主",
                },
                {
                    id:4,
                    subdistrict_name:"珑城花园",
                    unit_name:"二号楼二单元",
                    enum_status:"家属",
                },

            ],
			// default_houseid:null,
			default_houseid:3,
		};
    }
    
    /************************************************************************************ Life */
    componentDidMount(){
        // SplashScreen.hide();
        // HttpTemp.get({
        //     url:"/CPage/myhouse/list.php",
        //     success:(res) => {
        //         let data = res.data;
        //         console.log(res.data)
        //         this.setState({
		// 			apply:data.apply,
		// 			house:data.house,
		// 			default_houseid:data.default_houseid,
        //         })
        //     }
        // })
    }

    /************************************************************************************ Func */
    /**
     * 点击撤销弹出弹窗
     */
    showConfirm = ()=>{
        // Modal.alert('','撤销房屋申请，您或其他人与该房屋的一切认证关系和权限同时撤销，确定撤销?', [
        //     { CText: '确定', onPress: () => console.log('确定') },
        //     { CText: '取消', onPress: () => console.log('取消'), style: 'cancel' },
        //   ]);
    }

	/************************************************************************************ Render */
	render() {
		return (
			<CPage>

                {/* 内容部分 */}
				<CScroll mt='96' bg='#efeff4' pt='20' >

                    {/* 房屋列表 审核中 */}
                    {this.state.apply.map((item,index)=>{
                        return(
                            <CColumn bg='#fff' mb='20' mx='20' ra='8'>
                                <CRow mx='20' bb='1 #f3f3f3' px='20' h='80' y='center'>
                                    <CBetween>
                                        <CHand y='center'>
                                            <CText size="28">{item.subdistrict_name}</CText>
                                        </CHand>
                                        <CHand y='center'>
                                            <CText size="28" bg='#3e86ea' color='#fff' size='24' px='20' py='8' ra='10'>{item.enum_checked}</CText>
                                        </CHand>
                                    </CBetween>
                                </CRow>
                                <CRow mx='20' bb='1 #f3f3f3' px='20' h='80' y='center' style={{width:Config.map.screen.width-40}}>
                                    <CText size="28">{item.unit_name}</CText>
                                </CRow>
                                <CRow mx='20' px='20' h='80' y='center' style={{width:Config.map.screen.width-40}}>
                                    <CText size="28">{item.enum_apply_status}</CText>
                                </CRow>
                            </CColumn>

                        )
                    })}

                    {/* 房屋列表 审核通过 */}
                    {this.state.house.map((item,index)=>{
                        return(
                            <CColumn bg='#fff' mb='20' mx='20' ra='8'>
                            <CRow mx='20' bb='1 #f3f3f3' px='20' h='80' y='center'>
                                <CBetween>
                                    <CHand y='center'>
                                        <CText size="28">{item.subdistrict_name}</CText>
                                    </CHand>
                                    <CHand y='center'>
                                        {this.state.default_houseid == item.id ? <CText bg='red' color='#fff' size='24' px='20' py='8' ra='10'>默认</CText>:<CText></CText>}
                                    </CHand>
                                </CBetween>
                            </CRow>
                            <CRow mx='20' bb='1 #f3f3f3' px='20' h='80' y='center' style={{width:Config.map.screen.width-40}}>
                                <CText size="28">{item.unit_name}</CText>
                            </CRow>
                            <CRow mx='20' px='20' h='80' y='center' style={{width:Config.map.screen.width-40}}>
                                <CText size="28">{item.enum_status}</CText>
                            </CRow>
                        </CColumn>

                        )
                    })}

				</CScroll>
				
                {/* header */}
                <PHeader nav={this.nav} right=
                    {
                        <CHand
                            onopacity='0.6'
                            onPress={()=>{ 
                                this.nav.navigate('User_Setting_House_Confirm');
                                // console.log("添加");
                            }}>
                            <CText size='26'>添加</CText>
                        </CHand>
                    }
                >我的房屋</PHeader>
                
			</CPage>
		);
	}
}
